package com.boot2.core.dao.batch.insert;

import java.util.HashMap;
import java.util.Map;

/**
 * @author zhangweilin
 * @date 2019/7/7 20:27
 * @Description: 批量提交数据库
 */
public interface BatchCommitInvoker {

    //    /**
//     * 需要批量提交的数据队列
//     */
    Map<String, BatchCommit<?>> taskMapQueue = new HashMap<>();


    /**
     * 实例调用
     *
     * @throws BatchCommitException
     */
    void invoke() throws BatchCommitException, InterruptedException;

    /**
     * 批量提交异常
     */
    class BatchCommitException extends RuntimeException {

        private final Throwable original;

        public BatchCommitException(Throwable original) {
            super(original.getMessage(), original);
            this.original = original;
        }

        public Throwable getOriginal() {
            return this.original;
        }
    }

}
